home *** CD-ROM | disk | FTP | other *** search
/ Programming Sound Cards / Programming Sound Cards.iso / sound_45 / wav.h < prev   
C/C++ Source or Header  |  1995-01-01  |  5KB  |  117 lines

  1. /* BEGIN MICROSOFT COPYRIGHT ********************************************* */
  2. /* 
  3.  
  4.      (C) Copyright Microsoft Corp. 1991, 1992, 1993.  All rights reserved.
  5.    
  6.      You have a royalty-free right to use, modify, reproduce and 
  7.      distribute the Sample Files (and/or any modified version) in 
  8.      any way you find useful, provided that you agree that 
  9.      Microsoft has no warranty obligations or liability for any 
  10.      Sample Application Files. 
  11.  
  12. */
  13. /* END   MICROSOFT COPYRIGHT ********************************************* */
  14.  
  15. /* some of the stuff in this file is adapted from Microsoft Developers'
  16.    Sample files.  Modified by David Lai, lai%fastfood@daver.bungi.com */
  17.  
  18. /* BEGIN DAVID LAI COPYRIGHT ********************************************* */
  19. /*
  20. (C) Copyright David Lai 1993, 1994.  All rights reserved.
  21.  
  22. The source code is copyright by David Lai, however it is freely
  23. distributable and released for unrestricted use.  Users may copy or modify 
  24. this source code without charge, provided all copyright
  25. notices remain intact in all the source code.  Portions of the source code
  26. copyright by their respective copyright holders and are covered
  27. under different agreements, however the source code used has
  28. specifically been marked distributable royalty-free.
  29.  
  30. You can do whatever you want with it, even charge money for it, if
  31. you find a sucker willing to pay for it.  This is not shareware, the program
  32. is not crippled in any way, do not send money.  You can e-mail comments
  33. to the electronic mail address below, or fax to the fax number below.
  34.  
  35. If you add a feature thats useful, or do a new port, you can send
  36. the context diffs to the e-mail address below.  I may include it in
  37. subsequent releases.  Your code must specifically be marked
  38. freely distributable, I will not include code marked otherwise.
  39.  
  40. THE SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
  41. THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  42. PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  43.  
  44. The source code is provided with no support and without any obligation on
  45. the part of David Lai to assist in its use, correction,
  46. modification or enhancement.
  47.  
  48. DAVID LAI SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  49. INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
  50. OR ANY PART THEREOF.
  51.  
  52. In no event will David Lai be liable for any lost revenue
  53. or profits or other special, indirect and consequential damages, even if
  54. David Lai has been advised of the possibility of such damages.
  55.  
  56. David Lai
  57. 1370 McKendrie St
  58. San Jose, CA 95126
  59. fax: 408-241-4615
  60.  
  61. lai%fastfood@daver.bungi.com
  62.  
  63. */
  64. /* END   DAVID LAI COPYRIGHT ********************************************* */
  65.  
  66.  
  67. typedef uint16    WORD;
  68. typedef uint32    DWORD;
  69.  
  70. /* specific waveform format structure for PCM data */
  71. typedef struct pcmwaveformat_tag {
  72.     WORD    wFormatTag;        /* format type */
  73.     WORD    nChannels;         /* number of channels (i.e. mono, stereo...) */
  74.     DWORD   nSamplesPerSec;    /* sample rate */
  75.     DWORD   nAvgBytesPerSec;   /* for buffer estimation */
  76.     WORD    nBlockAlign;       /* block size of data */
  77.     WORD    wBitsPerSample;
  78. } PCMWAVEFORMAT;
  79.  
  80. /* flags for wFormatTag field of WAVEFORMAT */
  81. #define WAVE_FORMAT_PCM     1
  82.  
  83. /* define the mmioFOURCC macro to convert 4 chars to a uint32 , little-endian */
  84. #define mmioFOURCC(a,b,c,d) ( ((uint32)(d) << 24) | ((uint32)(c) << 16) | ((uint32)(b) << 8) | ((uint32)(a)))
  85.  
  86. /* define the necessary FOURCC constants */
  87.  
  88. #define cc4_WAVE    mmioFOURCC('W', 'A', 'V', 'E')
  89. #define cc4_LIST    mmioFOURCC('L', 'I', 'S', 'T')
  90. #define cc4_fmt        mmioFOURCC('f', 'm', 't', ' ')
  91. #define cc4_data    mmioFOURCC('d', 'a', 't', 'a')
  92. #define cc4_RIFF    mmioFOURCC('R', 'I', 'F','F')
  93. #define cc4_INFO    mmioFOURCC('I', 'N', 'F','O')
  94. #define cc4_INAM    mmioFOURCC('I', 'N', 'A','M')
  95. #define cc4_ISFT    mmioFOURCC('I', 'S', 'F','T')
  96. #define cc4_ICMT    mmioFOURCC('I', 'C', 'M','T')
  97.  
  98. /* round up to an even number */
  99.  
  100. #define EVEN(x) (((x)%2==0)?(x):((x)+1))
  101.  
  102. extern 
  103.     FILE * wav_write PROTO((signed char *sample_data, struct sample *sample_info,
  104.         uint32 sample_rate, int info_flag)) ;
  105. extern 
  106.     void wav_write_final PROTO((FILE *fw, struct sample *sample_info,
  107.         uint32 sample_rate, int info_flag)) ;
  108.  
  109. #if 0
  110. $Id: wav.h,v 1.1 1994/03/19 09:21:31 dlai Exp $
  111. $Log: wav.h,v $
  112.  * Revision 1.1  1994/03/19  09:21:31  dlai
  113.  * Initial revision
  114.  *
  115.  
  116. #endif
  117.